{extend name="../../admin/view/main"}

{block name="button"}
<!--{if auth("add")}-->
<button data-open='{:url("add")}{if $position_id}?position_id={$position_id}{/if}' data-title="添加广告" class='layui-btn layui-btn-sm layui-btn-primary'>添加广告</button>
<!--{/if}-->
<!--{if auth("remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除广告</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='poster/poster/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">排序</button>
            </th>
            <th class='text-center nowrap'>ID</th>
            <th class='text-left nowrap' width="10%">广告名称</th>
            <th class='text-left nowrap' width="10%">广告位</th>
            <th class='text-left nowrap padding-0 relative' style="min-width:400px">
                <div class="layui-row" style="line-height:28px">
                    <div class="layui-col-xs3 text-center layui-elip">状态</div>
                    <div class="layui-col-xs3 text-center layui-elip">创建时间</div>

                </div>
            </th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
            <td class='text-center nowrap'>
                {$vo.id}
            </td>
            <td class='text-left nowrap'>
                {notempty name='vo.ad_img'}
                <img data-tips-image style="width:20px;height:20px" src="{$vo.ad_img|default=''}" class="margin-right-5 text-top">
                {/notempty}
                <div class="inline-block">
                    {$vo.title|default='--'}
                </div>
            </td>
            <th class='text-left nowrap'>{$vo.position.title|default='--'}</th>

            <td class='text-left nowrap padding-0 relative'>
                <div style="overflow:auto;max-height:68px;padding:5px 0">

                    <div class="layui-row" style="line-height:23px">
                        <div class="layui-col-xs3 text-center layui-elip font-s10">
                            {if isset($vo.status) and $vo.status eq 1}
                            <!--{if auth("forbid")}-->
                            <a class="layui-btn layui-btn-sm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">正常</a>
                            <!--{else}-->
                            <a data-tips-text="你没有操作权限!" class="layui-btn layui-btn-sm layui-disabled">停用</a>
                            <!--{/if}-->
                            {else}
                            <!--{if auth("resume")}-->
                            <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">停用</a>
                            <!--{else}-->
                            <a data-tips-text="你没有操作权限!" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">停用</a>
                            <!--{/if}-->
                            {/if}

                        </div>

                        <div class="layui-col-xs3 text-center layui-elip color-blue font-s10">{$vo.create_at}</div>

                    </div>

                </div>
            </td>
            <td class='text-left nowrap'>

                <div class="nowrap margin-bottom-5">
                    {if auth("edit")}
                    <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>修改</a>
                    {else}
                    <a data-tips-text="您没有操作权限!" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">修改</a>
                    {/if}

                    {if auth("remove")}
                    <a class="layui-btn layui-btn-sm layui-btn-danger layui-hide" data-confirm="确定删除吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删除</a>
                    {else}
                    <a data-tips-text="您没有操作权限!" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled layui-hide">删除</a>
                    {/if}

                </div>


            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">No record</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
